/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package group6renderer.renderernode;

import group6renderer.Display;
import group6renderer.Visitor;

/**
 *
 * @author jonnie
 */
public class AlignmentNode extends FormatNode
{
    public AlignmentNode(String name)
    {
	
    this.name = name;//getName(name);
    }

    @Override
    public void drawNode(Display disp)
    {
		disp.getState().setAlignment(name);
		
    }

    @Override
    public boolean hasClosing()
    {
	return true;
    } 

    @Override
    public TreeNode copy()
    {
	return new AlignmentNode(name);
    }

    @Override
    public void accept(Visitor theVisitor)
    {
	theVisitor.visit(this);
    }
    
    private String getName(String name)
    {
    	if (name.charAt(0)=='c')
    		return "center";
    	if (name.charAt(0)=='l')
    		return "left";
    	
    	return "right";
    	
    }
    
}